<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <div class="layui-form layuimini-form">
            <div class="layui-form-item">
                <label class="layui-form-label">网站名称</label>
                <div class="layui-input-block">
                    <input type="text" name="site_name" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">网站LOGO</label>
                <div class="layui-input-block">
                    <input type="text" name="site_logo" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">浏览器图标</label>
                <div class="layui-input-block">
                    <input type="text" name="site_icon" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">备案号</label>
                <div class="layui-input-block">
                    <input type="text" name="site_beian" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-block">
                    <input type="text" name="site_copyright" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">统计脚本</label>
                <div class="layui-input-block">
                    <textarea name="site_script" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use([], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            http = layui.http,
            form = layui.form;

        //拉取信息
        http.ajaxPost('/admin/Setting/getBase', {}, function (data) {
            $("[name='site_name']").val(data.site_name);
            $("[name='site_logo']").val(data.site_logo);
            $("[name='site_icon']").val(data.site_icon);
            $("[name='site_beian']").val(data.site_beian);
            $("[name='site_copyright']").val(data.site_copyright);
            $("[name='site_script']").val(data.site_script);
        });

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            http.ajaxPost('/admin/Setting/saveBase', data.field, function (data) {
                layer.msg('保存成功', { time: 1000 }, function () { });
            });
        });
    });
</script>